package com.lonewalker.sparrow.convertor;

import com.lonewalker.sparrow.entity.SysUser;
import com.lonewalker.sparrow.entity.UserInfo;
import com.lonewalker.sparrow.req.UserAddReq;
import com.lonewalker.sparrow.req.UserReq;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

/**
 * 用户数据转换器
 *
 * @author: lonewalker
 */
@Mapper
public interface UserConvertor {

    UserConvertor INSTANCE = Mappers.getMapper( UserConvertor.class );

    SysUser toEntity(UserReq req);

    /**
     * 请求参数类转为实体类
     * @param req 用户信息添加请求参数类
     * @return UserInfo
     */
    UserInfo req2Po(UserAddReq req);
}
